<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@ page contentType="text/html; charset=UTF-8" language="java"
	import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/page/base.jsp"%>

<html>
	<head>
		<title>${title }</title>
		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="This is my page">
		<link type="text/css" href="<%=path%>/manage/css/layout.css" rel="stylesheet" />
		<link rel="stylesheet" type="text/css" href="<%=path%>/manage/css/Tooltip.css" />
        <link type="text/css" href="<%=path%>/manage/css/new_style.css" rel="stylesheet" />
		<script type="text/javascript" src="<%=path%>/manage/js/jquery-1.4.4.min.js"></script>
		<script type="text/javascript" src="<%=path%>/manage/js/easyTooltip.js"></script>
		<script type="text/javascript" src="<%=path%>/manage/js/jquery-ui-1.8.11.custom.min.js"></script>
		<script type="text/javascript" src="<%=path%>/manage/js/jquery.wysiwyg.js"></script>
		<script type="text/javascript" src="<%=path%>/manage/js/hoverIntent.js"></script>
		<script type="text/javascript" src="<%=path%>/manage/js/superfish.js"></script>
		<script type="text/javascript" src="<%=path%>/manage/js/custom.js"></script>
	  <script type="text/javascript">
	  	function editContent(obj,id){
	  		if ($(obj).attr("editStatus")== "true")
	  			return;
	  		var dataObj = $(obj).parent().prev();
	  		var value = $(dataObj).html().trim();
	  		var inputLen = value.length;
	  		if (inputLen < 30){
	  			inputLen = 30;
	  		} else if(inputLen > 80) {
	  			inputLen = 80;
	  		}
	  		var editInput = "<input type='text' size='"+inputLen+"' id='content"+id+"' value='"+value+"' /></br>" +
	  			"<a style='text-decoration:none;' href='javascript:void(0)' onclick='doContentSave("+id+",this)'>[保存]</a>&nbsp;&nbsp;" +
	  			"<a style='text-decoration:none;' href='javascript:void(0)' onclick='doContentCancel("+id+",this)'>[取消]</a>";
	  		$(dataObj).html(editInput);
	  		$(obj).attr("editStatus","true");
	  	}
	  	
	  	function doContentCancel(id,obj){
	  		$(obj).parent().html($("#contentInit"+id).val());
	  		$("#link"+id).attr("editStatus","false");
	  	}
	  	
	  	function doContentSave(id,obj) {
	  		var value = $("#content"+id).val().trim();
	  		if(!checkContent(value))
	  			return;
	  		$.ajax({
				url : root+'/more/doClientMoreSave.action',
				method : 'post',
				dataType : 'json',
				data:{"id":id,"content":encodeURI(encodeURI(value))},
				success : function(data) {
					$(obj).parent().html(value);
					$("#contentInit"+id).val(value);
				},
				error:function(err){
					if(err.responseText!='')
						alert(err.responseText);
					else
						alert("请求失败！");
				}
			});
	  		$("#link"+id).attr("editStatus","false");
	  	}
	  	
	  	function delClientMore(obj,id) {
	  		if(window.confirm("确认删除该条记录？")){
	  			$.ajax({
					url : root+'/more/deleteMoreContent.action',
					method : 'post',
					dataType : 'json',
					data:{"id":id},
					success : function(data) {
						$(obj).parent().parent().remove();
					},
					error:function(err){
						if(err.responseText!='')
							alert(err.responseText);
						else
							alert("请求失败！");
					}
				});
	  		}
	  	}
	  	
	  	function checkContent(value) {
	  		var len = countCharacters(value);
	  		if(len <=0 ){
	  			alert("请输入内容");
	  			return false;
	  		}else if(len>100){
	  			alert("长度不能超过100个字符，中文占2个字符，您当前输入了" +len + "个字符");
	  			return false;
	  		}
	  		return true;
	  	}
	  	
	  	function countCharacters(str){
		    var totalCount = 0; 
		    for (var i=0; i<str.length; i++) { 
		        var c = str.charCodeAt(i); 
		        if ((c >= 0x0001 && c <= 0x007e) || (0xff60<=c && c<=0xff9f)) { 
		             totalCount++; 
		         }else {     
		             totalCount+=2; 
		         } 
		     }
		    return totalCount;
		}
	  </script>
	</head>
	</head>


	<body>
		<div>
			<p class="sitemap">
				当前位置：客户端功能管理 > ${title }
			</p>
			<h1>
				${title }
			</h1>
			<div>
				<!-- Tabs -->
				<div id="tabs">
					<ul>
						<li>
							<a href="#tabs-1">${title }列表</a>
						</li>

					</ul>
		<!-- 检索 -->	
		<!-- 检索 END-->	
				<table class="fullwidth" cellpadding="0" cellspacing="0" id="enterInfoTab">
					<thead>
						<tr>
							<td>
								栏目名称
							</td>
							<td>
								所属位置
							</td>
							<td>
							    ${contentName }
							</td>			
							<td>
								操作
							</td>
						</tr>
						</thead>
                       <tbody>
						<s:iterator value="lstClientMores">
							<tr class="odd">
								<input type="hidden" id="contentInit<s:property value='INT_MORE_CONTENT' />" value="<s:property value='VAR_MORE_CONTENT' />" />
								<td>
									<s:property value="VAR_MORE_NAME" />
								</td>
								<td>
									<s:property value="VAR_TITLE_NAME" />
								</td>
								<td style="width:55%;word-break:break-all;">
									<s:property value="VAR_MORE_CONTENT" />
								</td>
								
								<td>
									<a class="icon icon_edit" id="link<s:property value="INT_MORE_CONTENT" />" title="编辑 " onclick="editContent(this,'<s:property value="INT_MORE_CONTENT" />')" editStatus="false"  href="javascript:void(0)"> </a>
									<a class="icon icon_delete" title="删除" href="javascript:void(0)" onclick="delClientMore(this,'<s:property value="INT_MORE_CONTENT" />')"></a>
								</td>
							</tr>
						</s:iterator>
					</tbody>
				</table>
				</div>
				
		</div>
		</div>


	</body>
</html>
